import Vue from 'vue'
import Vuex from 'vuex'
import { getGiftslist } from '@/api/search.js'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    giftlistX: null,
    giftlistX1: null
  },
  mutations: {
    updateGiftlist(state, list) {
      state.giftlistX = list
      state.giftlistX1 = list
    }
  },
  actions: {
    async getSearchGift(context) {
      const res = await getGiftslist()
      console.log(res)
      context.commit('updateGiftlist', res.data)
    }
  },
  modules: {}
})
